package 蓝桥杯;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/11/17
 */

public class 数列排序 {

    static int N = 210;
    static int n;
    static int[] arr = new int[N];

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        n = Integer.parseInt(reader.readLine());
        String[] nums = reader.readLine().split(" ");
        for (int i = 0; i < n; i++) { // 初始化
            arr[i] = Integer.parseInt(nums[i]);
        }
        quickSort(arr,0,n - 1);

        for (int i = 0; i < n; i++) {
            System.out.print(arr[i] + " ");
        }

    }

    private static void quickSort(int[] arr, int left, int right) {
        if (left >= right) return;
        int x = arr[left], i = left - 1, j = right + 1;
        while (i < j) {
            do i++; while (arr[i] < x);
            do j--; while (arr[j] > x);
            if (i < j) {
                int t = arr[i];
                arr[i] = arr[j];
                arr[j] = t;
            }
        }
        quickSort(arr, left, j);
        quickSort(arr, j + 1, right);

    }
}
